<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<portlet:defineObjects />

<p style="color:green"><c:out value="${requestScope.message}"/></p>

<script type="text/javascript">
    var editPageUrl = '<portlet:actionURL/>';
    var viewPageUrl = '<portlet:actionURL portletMode="view"/>';
    var isViewArbitTxtPortlet = false;
    function onArbitTxtPortletFormPost(){
        var frm = document.getElementById('arbtTextPortletFrm');
        if(isViewArbitTxtPortlet){
            frm.action = viewPageUrl;
        }
        return true;
    }
</script>

<form id="arbtTextPortletFrm"
        action="<portlet:actionURL/>"
        method="post"
        onsubmit="onArbitTxtPortletFormPost();">
    <label for="arbitraryText">Arbitrary Text: </label> <br/>
    <textarea name="arbitraryText" cols="79" rows="20"><c:out value="${requestScope.arbitraryText}" escapeXml="true"/></textarea> <br/>
    <input type="submit" value="Change!" onclick="isViewArbitTxtPortlet=false;"/>
    <input type="submit" value="Change and go to View!" onclick="isViewArbitTxtPortlet=true;"/>
</form>
